\documentclass{article}
\usepackage{xltxtra}
\usepackage{ctex}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{geometry}
\usepackage{booktabs}

\makeatletter
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother
\geometry{a4paper,top=1.5cm,bottom=1.5cm}

\title{Theoretical questions for Section 3.}
\author{张皓祥 \\ 3200102536 强基数学2001}
\date{}

\begin{document}
\maketitle

% Question 1
\noindent \textbf{\Rmnum{1}. Is $s(x)$ a natural cubic spline?}

\noindent \textbf{Sol.}

Since $s(x)\in\mathbb{S}^2_3,$ it's necessary that
\begin{align*}
    s(1) & =(2-1)^3=1 \\
    s'(1) & =[(2-x)^3]'|_{x=1}=-3(2-x)^2|_{x=1}=-3 \\
    s''(1) & =[(2-x)^3]''|_{x=1}=6(2-x)|_{x=1}=6.
\end{align*} 
Assume that $p(x)=ax^3+bx^2+cx+d$, by the conditions, we have
\begin{equation*}
    \begin{cases}
        p(0) & = d = 0 \\
        p(1) & = a+b+c+d = 1 \\
        p'(1) & = 3a+2b+c = -3 \\
        p''(1) & = 6a+2b = 6
    \end{cases}
    \quad \Longrightarrow \quad
    \begin{cases}
        a & = 7   \\
        b & = -18 \\
        c & = 12  \\
        d & = 0
    \end{cases}
\end{equation*}
Thus $p(x)=7x^3-18x^2+12x$.

But $p''(0)=(42x-36)|_{x=0}=-36,$ it means $s(x)$ is not a natural cubic spline.

\bigskip

% Question 2
\noindent \textbf{\Rmnum{2}. Interpolating $f$ on $\left[a,b\right]$ with a quadratic spline $s\in\mathbb{S}^1_2$.}

\noindent \textbf{Sol.}

\noindent \textbf{(a).}

Since $s\in \mathbb{S}_2^1$, for $x\in[x_i,x_{i+1}],i=1,2,\cdots,n-1$, let 
$p_i=s|_{[x_i,x_{i+1}]}$, we can assume $p_i(x) = a_ix^2+b_ix+c_i$. 
Then for $i=2,3,\cdots,n-2,p_i(x_i)=p_{i-1}(x_i)=f(x_i),p_i(x_{i+1})=p_{i+1}(x_{i+1})=f(x_{i+1}),
p_i'(x_i)=p_{i+1}'(x_i)=f'(x_i),p_i'(x_{i+1})=p_{i+1}'(x_{i+1})=f'(x_{i+1}).$ If we only know the value $f(x_i)$ at 
every point $x_i$, we cannot determine three unknown elements by two equations
\begin{equation*}
    \begin{cases}
        x_i^2a_i+x_ib_i+c_i & = f_i \\
        x_{i+1}^2a_i+fx_{i+1} b_i+c_i & = f_{i+1}
    \end{cases}
\end{equation*}
Hence an additional condition is needed to determine $s$ uniquely.

\noindent \textbf{(b).}

For $p_i$, assume $p_i(x)=a_ix^2+b_ix+c_i$, then $p_i'(x)=2a_ix+b_i$. We know $f_i,f_{i+1},m_1$, which means
\begin{equation*}
    \begin{cases}
        x_i^2a_i+x_ib_i+c_i & =f_i \\
        x_{i+1}^2a_i+x_{i+1}b_i+c_i & =f_{i+1} \\
        2x_ia_i+b_i & =m_i
    \end{cases}
    \quad \Longrightarrow \quad
    \left[
    \begin{matrix}
        x_i^2 & x_i & 1 \\
        x_{i+1}^2 & x_{i+1} & 1 \\
        2x_i & 1 & 0
    \end{matrix}
    \right]
    \left[
    \begin{matrix}
        a_i \\ b_i \\ c_i
    \end{matrix}
    \right]
    =
    \left[
    \begin{matrix}
        f_i \\ f_{i+1} \\ m_i
    \end{matrix}
    \right]
\end{equation*}
Since $x_i,x_{i+1}$ are distinct, we can get $\left(x_i^2,x_i,1\right)'.\left(x_{i+1}^2,x_{i+1},1\right)',
\left(2x_i,1,0\right)'$ are linearly independent, which means the cofficient matrix of the linear equation is 
of full rank and invertible. Hence
\begin{equation*}
    \left[
    \begin{matrix}
        a_i \\ b_i \\ c_i
    \end{matrix}
    \right]
    =
    \left[
    \begin{matrix}
        x_i^2 & x_i & 1 \\
        x_{i+1}^2 & x_{i+1} & 1 \\
        2x_i & 1 & 0
    \end{matrix} 
    \right]^{-1}
    \left[
    \begin{matrix}
        f_i \\ f_{i+1} \\ m_i
    \end{matrix}
    \right]
\end{equation*}
i.e. $p_i$ is uniquely determined by $f_i,f_{i+1},m_i$.

\noindent \textbf{(c).}

Use mathematical induction.

For $k=2$, choose the interval $\left[x_1,x_2\right],$ by (b), $p_1$ is uniquely determined by $f_1,f_2,m_1.$ 
Since $p_1$ is determined, $m_2=p_1'(x_2)$ is computed.

If for $2\leq k\leq n-2,m_k$ is computed. Now consider $k+1$, since $f_k,f_{k+1},m_k$ are known, by (b), $p_k$ 
is uniquely determined. Thus $m_{k+1}=p_k'(x_{k+1})$ is computed.

By mathematical induction, all $m_2,m_3,\cdots,m_{n-1}$ can be computed.

\bigskip

% Question 3
\noindent \textbf{\Rmnum{3}. Determine a nutural cubic spline with knots.}

\noindent \textbf{Sol.}

By definition of $s_1(x)=1+c(x+1)^3,s_1'(x)=3c(x+1)^2,s_1''(x)=6c(x+1,)$ we have $s_1(0)=1+c,s_1'(0)=3c,s_1''(0)=6c.$ 
Since $s$ is a natural cubic spline on $\left[-1,1\right]$, we can assume $s_2(x)=ax^3+bx^2+ex+d$. 
It implies that $s_2'(x)=3ax^2+2bx+e$ and $s_2''(x)=6ax+2b$. Then we have
\begin{equation*}
    \begin{cases}
        s_2(0)=s_1(0)\quad\Rightarrow\quad d=1+c \\
        s_2'(0)=s_1'(0)\quad\Rightarrow\quad e=3c \\
        s_2''(0)=s_1''(0)\quad\Rightarrow\quad 2b=6c \\
        s_2(1)=a+b+e+d=-1 \\
        s_2''(1) = 6a+2b=0
    \end{cases}
    \quad\Longrightarrow\quad
    \begin{cases}
        a = \frac{1}{3} \\
        b = -1 \\
        c = -\frac{1}{3} \\
        d = \frac{2}{3} \\
        e = -1
    \end{cases}
\end{equation*}
The equation has only one solution, so $c$ must be chosen as $-\frac{1}{3}$ if one wants $s(1)=-1$.

\bigskip

% Question 4
\noindent \textbf{\Rmnum{4}. Consider $f(x)=\cos(\frac{\pi}{2}x)$ with $x\in\left[-1,1\right].$}

\noindent \textbf{Sol.}

\noindent \textbf{(a).}

Since $f(x)=\cos(\frac{\pi}{2}x),$ derivative it, $f'(x)=-\frac{\pi}{2}\sin(\frac{\pi}{2}x),
f''(x)=-\frac{\pi^2}{4}\cos(\frac{\pi}{2}x).$

\begin{center}
\begin{tabular}{c|ccc}
    & -1 & 0 & 1 \\
    \hline
    $f(x)$ & 0 & 1 & 0 \\
    $f'(x)$ & $\frac{\pi}{2}$ & 0 & $-\frac{\pi}{2}$ \\
    $f''(x)$ & 0 & $-\frac{\pi^2}{4}$ & 0
\end{tabular}
\end{center}

Assume that 
\begin{equation*}
    s(x) = 
    \begin{cases}
        s_1(x) = a_1x^3+b_1x^2+c_1x+d_1,\quad x\in\left[-1,0\right] \\
        s_2(x) = a_2x^3+b_2x^2+c_2x+d_2,\quad x\in\left[0,1\right]
    \end{cases}
\end{equation*}
Put them into the conditions of natural cubic spline, we have
\begin{equation*}
    \begin{cases}
        s_1(-1)=-a_1+b_1-c_1+d_1=0 \\
        s_1''(-1) = -6a_1+2b_1=0 \\
        s_2(1)=a_2+b_2+c_2+d_2=0 \\
        s_2''(1)=6a_2+2b_2=0 \\
        s_1(0)=s_2(0)=f_0\Rightarrow d_1=d_2=1 \\
        s_1'(0)=s_2'(0)\Rightarrow c_1=c_2 \\
        s_1''(0)=s_2''(0)\Rightarrow 2b_1=2b_2
    \end{cases}
    \quad \Longrightarrow \quad
    \begin{cases}
        a_1 = -\frac{1}{2} \\ b_1 = -\frac{3}{2} \\ c_1 = 0 \\ d_1 = 1 \\
        a_2 = \frac{1}{2}  \\ b_2 = -\frac{3}{2} \\ c_2 = 0 \\ d_2 = 1
    \end{cases}
\end{equation*}
It implies that
\begin{equation*}
    s(x) = 
    \begin{cases}
        -\frac{1}{2}x^3-\frac{3}{2}x^2+1, & x\in\left[-1,0\right] \\
        \frac{1}{2}x^3-\frac{3}{2}x^2+1, & x\in\left[0,1\right].
    \end{cases}
\end{equation*}

\noindent \textbf{(b).}

By (a), we have
\begin{equation*}
    s''(x) = 
    \begin{cases}
        -3x-3, & x\in\left[-1,0\right] \\
        3x-3, & x\in\left[0,1\right]
    \end{cases}
\end{equation*}
Thus $\int_{-1}^1|s''(x)|^2dx=6.$

\noindent \textbf{(i)} For the quadratic polynomial, we assume 
$$
g(x) = ax^2 + bx + c
$$
Put thm into the equations, we have
\begin{equation*}
    \begin{cases}
        g(-1) = a-b+c = 0 \\
        g(0) = c = 1 \\
        g(1) = a+b+c = 0
    \end{cases}
    \quad \Longrightarrow \quad
    \begin{cases}
        a=-1 \\ b=0 \\ c=1
    \end{cases}
\end{equation*}
It implies that $g(x)=-x^2+1,g''(x)=-2.$ Hence $\int_{-1}^1|g(x)|^2dx=8>6=\int_{-1}^1|s''(x)|^2dx.$

\noindent \textbf{(ii)} Since $f''(x)=-\frac{\pi^2}{4}\cos(\frac{\pi}{2}x),$ we have 
$$
\int_{-1}^1|f''(x)|^2dx=\frac{\pi^4}{16}\int_{-1}^1\cos^2(\frac{\pi}{2}x)dx=
\frac{\pi^4}{16}\int_{-1}^1\frac{1+\cos(\pi x)}{2}dx=\frac{\pi^4}{16} \approx 6.088>6
$$
Hence $\int_{-1}^1|f''(x)|^2dx>\int_{-1}^1|s''(x)|^2dx.$

In conclusion, we can verify that natural cubic splines have the minimal total bending energy by the two cases.

\bigskip
% Question 5
\noindent \textbf{\Rmnum{5}. The quadratic B-spline $T^2_i(x)$.}

\noindent \textbf{Sol.}

% Topic (a)
\noindent \textbf{(a)}

By the recursive definition of B-splines and $B_i^1=\hat{B}_i$, the derivation of $B_i^2$ is 
\begin{align*}
    \frac{d}{d x}B_i^2(x) = &\frac{d}{dx}(\frac{x-t_{i-1}}{t_{i+1}-t_{i-1}}B_i^1(x)+\frac{t_{i+2}-x}{t_{i+2}-t_i}B_{i+1}^1(X)) \\
    = & \frac{1}{t_{i+1}-t_{i-1}}\hat{B}_i(x)+\frac{x-t_{i-1}}{t_{i+1}-t_{i-1}}\frac{d}{dx}\hat{B}_i(x) \\
    & -\frac{1}{t_{i+2}-t_{i}}\hat{B}_{i+1}(x)+\frac{t_{i+2}-x}{t_{i+2}-t_{i}}\frac{d}{dx}\hat{B}_{i+1}(x)
\end{align*}
Since it's known that
\begin{equation*}
    \hat{B}_i(x) = 
    \begin{cases}
        \frac{x-t_{i-1}}{t_i-t_{i-1}} & x\in(t_{i-1},t_i], \\
        \frac{t_{i+1}-x}{t_{i+1}-t_i} & x\in(t_i,t_{i+1}], \\
        0 & \mbox{otherwise.}
    \end{cases}
    \quad \Rightarrow \quad
    \frac{d}{dx} \hat{B}_i(x) = 
    \begin{cases}
        \frac{1}{t_i-t_{i-1}} & x\in(t_{i-1},t_i], \\
        -\frac{1}{t_{i+1}-t_i} & x\in(t_i,t_{i+1}], \\
        0 & \mbox{otherwise.}
    \end{cases}
\end{equation*}
Hence, for $\frac{d}{dx}B_i^2(x)$, when $x\in(t_{i-1},t_i]$,
$$
\frac{d}{dx}B_i^2(x)=\frac{1}{t_{i+1}-t_{i-1}}\frac{x-t_{i-1}}{t_i-t_{i-1}} + 
\frac{x-t_{i-1}}{t_{i+1}-t_{i-1}}\frac{1}{t_i-t_{i-1}} = 
\frac{2(x-t_{i-1})}{(t_i-t_{i-1})(t_{i+1}-t_{i-1})}.
$$
When $x\in(t_i,t_{i+1}]$,
\begin{align*}
    \frac{d}{dx}B_i^2(x) & = \frac{(t_{i+1}-x)-(x-t_{i-1})}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
                             \frac{-(x-t_i)+(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = \frac{t_{i-1}+t_{i+1}-2x}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
    \frac{t_i+t_{i+2}-2x}{(t_{i+2}-t_i)(t_{i+1}-t_i)}.
\end{align*}
When $x\in(t_{i+1},t_{i+2}]$,
$$
\frac{d}{dx}B_i^2(x)=\frac{-(t_{i+2}-x)-(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})}
=\frac{-2(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})}
$$
Otherwise, $\frac{d}{dx}B_i^2(x)=0$. In conclusion,
\begin{equation*}
    \frac{d}{dx}B_i^2(x) = 
    \begin{cases}
        \frac{2(x-t_{i-1})}{(t_i-t_{i-1})(t_{i+1}-t_{i-1})} & x\in(t_{i-1},t_i] \\
        \frac{t_{i-1}+t_{i+1}-2x}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
        \frac{t_i+t_{i+2}-2x}{(t_{i+2}-t_i)(t_{i+1}-t_i)} & x\in(t_i,t_{i+1}] \\
        \frac{-2(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})} & x\in(t_{i+1},t_{i+2}] \\
        0 & \mbox{otherwise.}
    \end{cases}
\end{equation*}

% Topic (b)
\noindent \textbf{(b)}
$\bullet$ At poitn $t_i$:

\noindent When $x\in(t_{i-1},t_i],\frac{d}{dx}B_i^2(x)=\frac{2(x-t_{i-1})}{(t_i-t_{i-1})(t_{i+1}-t_{i-1})}$, 
so $\lim\limits_{x\to t_i^-}\frac{d}{dx}B_i^2(x)=\frac{2}{t_{i+1}-t_{i-1}}$. Besides, when 
$x\in(t_i,t_{i+1}],\frac{d}{dx}B_i^2(x)=\frac{t_{i-1}+t_{i+1}-2x}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
\frac{t_i+t_{i+2}-2x}{(t_{i+2}-t_i)(t_{i+1}-t_i)},$ so
\begin{align*}
    \lim\limits_{x\to t_i^+}\frac{d}{dx}B_i^2(x) & =
    \frac{t_{i-1}+t_{i+1}-2t_i}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
    \frac{t_i+t_{i+2}-2t_i}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = \frac{t_{i+1}-t_i}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + \frac{t_{i-1}-t_{i}}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)}
    +\frac{t_{i+2}-t_i}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = \frac{1}{t_{i+1}-t_{i-1}}+\frac{(t_{i+1}-t_i)-(t_{i+1}-t_{i-1})}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)}
    \frac{1}{t_{i+1}-t_{i-1}} \\
    & = \frac{1}{t_{i+1}-t_{i-1}} + \frac{1}{t_{i+1}-t_{i-1}} - \frac{1}{t_{i+1}-t_{i-1}} + \frac{1}{t_{i+1}-t_{i-1}} \\
    & = \frac{2}{t_{i+1}-t_{i-1}}.
\end{align*}
Thus $\lim\limits_{x\to t_i^-}\frac{d}{dx}B_i^2(x) = \lim\limits_{x\to t_i^+}\frac{d}{dx}B_i^2(x)$, 
which means $\frac{d}{dx}B_i^2(x)$ is continuous at $t_i$.

\noindent $\bullet$ At poitn $t_{i+1}$:

\noindent Similarly, when $x\in(t_{i+1},t_{i+2}),\frac{d}{dx}B_i^2(x)=\frac{-2(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})}$, 
so $\lim\limits_{x\to t_{i+1}^+}\frac{d}{dx}B_i^2(x)=-\frac{2}{t_{i+2}-t_i}$. 
When $x\in(t_i,t_{i+1}],$ as previous, we have
\begin{align*}
    \lim\limits_{x\to t_{i+1}^-}\frac{d}{dx}B_i^2(x) & = 
    \frac{t_{i-1}+t_{i+1}-2t_{i+1}}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
    \frac{t_i+t_{i+2}-2t_{i+1}}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = \frac{t_{i-1}-t_{i+1}}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
    \frac{t_i-t_{i+1}}{(t_{i+2}-t_i)(t_{i+1}-t_i)} + \frac{t_{i+2}-t_{i+1}}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = -\frac{1}{t_{i+1}-t_i}-\frac{1}{t_{i+2}-t_i}+\frac{(t_{i+2}-t_i)-(t_{i+1}-t_i)}{(t_{i+2}-t_i)(t_{i+1}-t_i)} \\
    & = -\frac{1}{t_{i+1}-t_i}-\frac{1}{t_{i+2}-t_i}+\frac{1}{t_{i+1}-t_i}-\frac{1}{t_{i+2}-t_i}
    =-\frac{2}{t_{i+2}-t_i}.
\end{align*}
Thus $\lim\limits_{x\to t_{i+1}^-}\frac{d}{dx}B_i^2(x) = \lim\limits_{x\to t_{i+1}^+}\frac{d}{dx}B_i^2(x)$, 
which means $\frac{d}{dx}B_i^2(x)$ is continuous at $t_{i+1}$.

% Topic (c)
\noindent \textbf{(c)}
When $x\in(t_{i-1},t_i],\frac{d}{dx}B_i^2(x)=\frac{2(x-t_{i-1})}{(t_i-t_{i-1})(t_{i+1}-t_{i-1})}>0$ since $x>t_{i-1}$.
So only need to consider $x\in(t_i,t_{i+1})$. In this interval, we have 
$$\frac{d}{dx}B_i^2(x)=\frac{t_{i-1}+t_{i+1}-2x}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
\frac{t_i+t_{i+2}-2x}{(t_{i+2}-t_i)(t_{i+1}-t_i)}.$$
If $\frac{d}{dx}B_i^2(x^*)=0,$ it implies that
\begin{align*}
    & \frac{t_{i-1}+t_{i+1}-2x^*}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + 
    \frac{t_i+t_{i+2}-2x^*}{(t_{i+2}-t_i)(t_{i+1}-t_i)} = 0 \\
    \Leftrightarrow\quad & (t_{i+2}-t_i)(t_{i-1}+t_{i+1}-2x^*) + (t_{i+1}-t_{i-1})(t_i+t_{i+2}-2x^*) = 0 \\
    \Leftrightarrow\quad & 2(t_{i+2}+t_{i+1}-t_i-t_{i-1})x^* = 2(t_{i+2}t_{i+1}-t_it_{i-1}) \\
    \Leftrightarrow\quad & x^* = \frac{t_{i+2}t_{i+1}-t_it_{i-1}}{t_{i+2}+t_{i+1}-t_i-t_{i-1}}.
\end{align*}
Since 
\begin{align*}
    t_{i+2}t_{i+1}-t_it_{i-1} - t_i(t_{i+2}+t_{i+1}-t_i-t_{i-1}) & = 
    t_{i+2}t_{i+1}+t_i^2-t_{i+2}t_i-t_{i+1}t_i \\
    & = (t_{i+2}-t_i)(t_{i+1}-t_i)>0 \\
    t_{i+1}(t_{i+2}+t_{i+1}-t_i-t_{i-1}) - t_{i+2}t_{i+1}-t_it_{i-1} & =
    t_{i+1}^2-t_{i+1}t_i-t_{i+1}t_{i-1}+t_it_{i-1} \\
    & = (t_{i+1}-t_i)(t_{i+1}-t_{i-1}) >0,
\end{align*}
we can get $x^*\in(t_i,t_{i+1})$ is correct.
In conclusion, there exist only one $x^*\in(t_{i-1},t_{i+1})$ satisfies $\frac{d}{dx}B_i^2(x^*)=0.$ 
$x^*=\frac{t_{i+2}t_{i+1}-t_it_{i-1}}{t_{i+2}+t_{i+1}-t_i-t_{i-1}}$.

% Topic (d)
\noindent \textbf{(d)}
When $x\in(t_{i+1},t_{i+2}),\frac{d}{dx}B_i^2(x)=\frac{-2(t_{i+2}-x)}{(t_{i+2}-t_i)(t_{i+2}-t_{i+1})}<0$ 
since $x<t_{i+2}$. Consequently, $\frac{d}{dx}B_i^2(x)$ has only one zero in the interval $[t_{i-1},t_{i+2}]$. 
By the definition of $B_i^2(x)\equiv 0$ when $x\notin [t_{i-1},t_{i+2}]$. 
Then by mathematical analysis, $\frac{d}{dx}B_i^2(x)$ reach its maximal point when $x=x^*$. 
Then only need to prove $B_i^2(x^*)<1.$
\begin{align*}
    &B_i^2(x^*) = 
    \frac{(x^*-t_{i-1})(t_{i+1}-x^*)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} +
    \frac{(t_{i+2}-x^*)(x^*-t_i)}{(t_{i+2}-t_i)(t_{i+1}-t_i)} < 1 \\
    \Leftrightarrow & (x^*-t_{i-1})(t_{i+1}-x^*)(t_{i+2}-t_i)+(t_{i+2}-x^*)(x^*-t_i)(t_{i+1}-t_{i-1}) \\
    & < (t_{i+1}-t_{i-1})(t_{i+1}-t_i)(t_{i+2}-t_i) \\
    \Leftrightarrow & 
    -t_{i-1} t_{i}^2 + t_{i}^2 t_{i+1} - t_{i} t_{i+1}^2 + t_{i+1}^2 t_{i+2} \\
    & + (2 t_{i-1} t_{i} - 2 t_{i+1} t_{i+2}) x^* + (- t_{i-1} - t_{i} + t_{i+1} + t_{i+2}) x^{*2} > 0
\end{align*}
Since $x^*=\frac{t_{i+2}t_{i+1}-t_it_{i-1}}{t_{i+2}+t_{i+1}-t_i-t_{i-1}}$, put it into the equation, 
we only need to prove 
\begin{align*}
    & -t_{i-1} t_{i}^2 + t_{i}^2 t_{i+1} - t_{i} t_{i+1}^2 + t_{i+1}^2 t_{i+2} - 
    \frac{(t_{i+2}t_{i+1}-t_it_{i-1})^2}{t_{i+2}+t_{i+1}-t_i-t_{i-1}} > 0 \\
    \Leftrightarrow & (-t_{i-1} t_{i}^2 + t_{i}^2 t_{i+1} - t_{i} t_{i+1}^2 + t_{i+1}^2 t_{i+2})(t_{i+2}+t_{i+1}-t_i-t_{i-1}) \\
    & - (t_{i+2}t_{i+1}-t_it_{i-1})^2 > 0 \\
    \Leftrightarrow & (t_{i+1}-t_{i-1}) (t_{i+1} - t_{i})^2 (t_{i+2} - t_{i})>0. \quad \mbox{It's trival.}
\end{align*}
Hence $B_i^2(x)\in[0,1)$ is proved.

% Topic (e)
\noindent \textbf{(e)}
If $t_i=i$, since $(x-(i-1))(i+1-x)+(i+2-x)(x-i)=1 - 2 i - 2 i^2 + (2 + 4 i) x - 2 x^2,$ we can get 
\begin{equation*}
    B_i^2(x) = 
    \begin{cases}
        \frac{(x-(i-1))^2}{2} & x\in(i-1,i], \\
        \frac{1 - 2 i - 2 i^2 + (2 + 4 i) x - 2 x^2}{2} & x\in(i,i+1] \\
        \frac{(i+2-x)^2}{2} & x\in(i+1,i+2] \\
        0 & \mbox{otherwise.}
    \end{cases}
\end{equation*}
Then we plot the function as follow:
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.8]{./ReportFigure/FigureE.png} \label{FigE}
\end{figure}

\bigskip
% Question 6
\noindent \textbf{\Rmnum{6}. Verify Theorem 3.32 algevraically.}

\noindent \textbf{Sol.}

\noindent We need to prove $B_i^2(x)=(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2$ algebraically. 
For one thing, 
\begin{equation*}
    B_i^2(x) = 
    \begin{cases}
        \frac{(x-t_{i-1})^2}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})}, & x\in(t_{i-1},t_i]; \\
        \frac{(x-t_{i-1})(t_{i+1}-x)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} +
        \frac{(t_{i+2}-x)(x-t_i)}{(t_{i+2}-t_i)(t_{i+1}-t_i)}, & x\in(t_i,t_{i+1}]; \\
        \frac{(t_{i+2}-x)^2}{(t_{i+2}t_i)(t_{i+2}-t_{i+1})}, & x\in(t_{i+1},t_{i+2}]; \\
        0, & \mbox{otherwise.}
    \end{cases}
\end{equation*}
For another,
\begin{equation*}
    (t-x)_+^2 = 
    \begin{cases}
        (t-x)^2 & \mbox{if } t\geq x, \\
        0 & \mbox{if } t<x.
    \end{cases}
\end{equation*}
%% Case 1
\noindent $\bullet$ When $x\leq t_{i-1}, (t_k-x)^2_+=(t_k-x)^2$ for $k\in\{i-1, i,i+1,i+2\}$. Hence we can 
get the $k$th divided difference as follow:

\begin{center}
\begin{tabular}{c|cccc}
    $t_{i-1}$ & $(t_{i-1}-x)^2$ & & & \\
    $t_i$ & $(t_i-x)^2$ & $t_{i}+t_{i-1}-2x$ & & \\
    $t_{i+1}$ & $(t_{i+1}-x)^2$ & $t_{i+1}+t_i-2x$ & 1 & \\
    $t_{i+2}$ & $(t_{i+2}-x)^2$ & $t_{i+2}+t_{i+1}-2x$ & 1 & 0
\end{tabular}
\end{center}
Then $(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2=0=B_i^2(x).$

%% Case 2
\noindent $\bullet$ When $x\in(t_{i-1},t_i], (t_k-x)^2_+=(t_k-x)^2$ for $k\in\{ i,i+1,i+2\},(t_{i-1}-x)^2_+=0$. Hence we can 
get the $k$th divided difference as follow:

\begin{center}
\begin{tabular}{c|cccc}
    $t_{i-1}$ & 0 & & & \\
    $t_i$ & $(t_i-x)^2$ & $\frac{(t_i-x)^2}{t_i-t_{i-1}}$ & & \\
    $t_{i+1}$ & $(t_{i+1}-x)^2$ & $t_{i+1}+t_i-2x$ & $-\frac{x^2-2t_{i-1}x-t_it_{i+1}+t_{i-1}t_i+t_{i-1}t_{i+1}}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})}$ & \\
    $t_{i+2}$ & $(t_{i+2}-x)^2$ & $t_{i+2}+t_{i+1}-2x$ & 1 & $y$
\end{tabular}
\end{center}
$y=\frac{(x-t_{i-1})^2}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})(t_{i+2}-t_{i-1})}$, then 
$$(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2=
\frac{(x-t_{i-1})^2}{(t_{i+1}-t_{i-1})(t_i-t_{i-1})}=B_i^2(x)$$

%% Case 3
\noindent $\bullet$ When $x\in(t_{i},t_{i+1}], (t_k-x)^2_+=(t_k-x)^2$ for $k\in\{i+1,i+2\},(t_{k}-x)^2_+=0$ for $k\in\{i-1,i\}$. Hence we can 
get the $k$th divided difference as follow:

\begin{center}
\begin{tabular}{c|cccc}
    $t_{i-1}$ & 0& & & \\
    $t_i$ & 0 & 0 & & \\
    $t_{i+1}$ & $(t_{i+1}-x)^2$ & $\frac{(t_{i+1}-x)^2}{t_{i+1}-t_{i}}$ & $\frac{(t_{i+1}-x)^2}{(t_{i+1}-t_{i})(t_{i+1}-t_{i-1})}$ & \\
    $t_{i+2}$ & $(t_{i+2}-x)^2$ & $t_{i+2}+t_{i+1}-2x$ & 
    $-\frac{x^2-2t_{i}x-t_{i+1}t_{i+2}+t_{i}t_{i+1}+t_{i}t_{i+2}}{(t_{i+2}-t_{i})(t_{i+1}-t_{i})}$ & $y$
\end{tabular}
\end{center}
\begin{align*}
    \Rightarrow & (t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2 \\
    = & (t_{i+2}-t_{i-1})y \\
    = & \frac{(t_{i+2}-t_{i-1})}{(t_{i+2}-t_{i-1})}[-\frac{x^2-2t_{i}x-t_{i+1}t_{i+2}+t_{i}t_{i+1}+t_{i}t_{i+2}}{(t_{i+2}-t_{i})(t_{i+1}-t_{i})}
    - \frac{(t_{i+1}-x)^2}{(t_{i+1}-t_{i})(t_{i+1}-t_{i-1})}] \\
    = & \frac{(t_{i+2}-x)(x-t_i)+(x-t_{i+1})(t_i-t_{i+2})}{(t_{i+2}-t_i)(t_{i+1}-t_i)}+
    \frac{(x-t_{i-1})(t_{i+1}-x)+(t_{i+1}-t_{i-1})(t_{i+1}-x)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} \\
    = & \frac{(t_{i+2}-x)(x-t_i)}{(t_{i+2}-t_i)(t_{i+1}-t_i)} - \frac{x-t_{i+1}}{t_{i+1}-t_i} + 
    \frac{(x-t_{i-1})(t_{i+1}-x)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} + \frac{x-t_{i+1}}{t_{i+1}-t_i} \\
    = & \frac{(t_{i+2}-x)(x-t_i)}{(t_{i+2}-t_i)(t_{i+1}-t_i)} + \frac{(x-t_{i-1})(t_{i+1}-x)}{(t_{i+1}-t_{i-1})(t_{i+1}-t_i)} \\
    = & B_i^2(x).
\end{align*}


%% Case 4
\noindent $\bullet$ When $x\in(t_{i+1},t_{i+2}], (t_{i+2}-x)^2_+=(t_{i+2}-x)^2,(t_{k}-x)^2_+=0$ for $k\in\{i-1,i,i+1\}$. Hence we can 
get the $k$th divided difference as follow:

\begin{center}
\begin{tabular}{c|cccc}
    $t_{i-1}$ & 0& & & \\
    $t_i$ & 0 & 0 & & \\
    $t_{i+1}$ & 0 & 0 & 0 & \\
    $t_{i+2}$ & $(t_{i+2}-x)^2$ & $\frac{(t_{i+2}-x)^2}{t_{i+2}-t_{i+1}}$ & 
    $\frac{(t_{i+2}-x)^2}{(t_{i+2}-t_{i+1})(t_{i+2}-t_{i})}$ & $\frac{(t_{i+2}-x)^2}{(t_{i+2}-t_{i+1})(t_{i+2}-t_{i})(t_{i+2}-t_{i-1})}$
\end{tabular}
\end{center}
Then $(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2=\frac{(t_{i+2}-x)^2}{(t_{i+2}-t_{i+1})(t_{i+2}-t_{i})}=B_i^2(x).$

%% Case 5
\noindent $\bullet$ When $x\geq t_{i+2},(t_{k}-x)^2_+=0$ for $k\in\{i-1,i,i+1,i+2\}$. Then all divided 
differences of the function are all 0, thus $(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2=0=B_i^2(x).$

\bigskip
\noindent In conclusion, we prove $(t_{i+2}-t_{i-1})[t_{i-1},t_i,t_{i+1},t_{i+2}](t-x)_+^2=B_i^2(x)$ is correct.

\bigskip
% Question 7
\noindent \textbf{\Rmnum{7}. Scaled integral of B-splines.}

\noindent \textbf{Sol.}

By the Theorem of derivative of B-splines, For $n\geq 2, \forall x\in \mathbb{R}$,
$$
\frac{d}{dx}B_i^n(x) =  \frac{nB_i^{n-1}(x)}{t_{i+n-1}-t_{i-1}} - \frac{nB_{i+1}^{n-1}(x)}{t_{i+n}-t_i}.
$$
Thus for $n\geq 1,i\geq 0$, denote $I_{n,i}=\frac{1}{t_{i+n}-t_{i-1}}\int_{t_{i-1}}^{t_{i+n}}B_i^n(x)dx.$ 
Then 
\begin{align*}
    (n+1) (I_{n,i}-I_{n,i+1}) & = \int_{t_{i-1}}^{t_{i+n+1}}(\frac{(n+1)B_i^n(x)}{t_{i+n}-t_{i-1}}-\frac{(n+1)B_{i+1}^{n}(x)}{t_{i+1+n}-t{i}})dx \\
    & = \int_{t_{i-1}}^{t_{i+n+1}}\frac{d}{dx}B_i^{n+1}(x)dx \\
    & = B_i^{n+1}(x)|_{t_{i-1}}^{t_{i+n+1}} \\
    & = 0.
\end{align*}
By mathmetical induction, $I_{n,i}-I_{n,j}=0$ for $\forall i,j.$ 
Hence the scale integral of B-splines is independent of the index $i$.

\bigskip
% Question 8
\noindent \textbf{\Rmnum{8}. Symmetic Polynomial.}

\noindent \textbf{Sol.}

% Topic (a)
\noindent \textbf{(a)}

When $m = 4, n = 2,$ it's equivalent to prove $\tau_2(x_i,x_{i+1},x_{i+2})=[x_i,x_{i+1},x_{i+2}]x^4.$

\noindent $\bullet$ LHS: By the definition, $\tau_2(x_i,x_{i+1},x_{i+2}) = x_1^2+x_2^2+x_3^2+x_1x_2+x_1x_3+x_2x_3.$

\noindent $\bullet$ RHS: For $x^4$, consider the $2$th divided difference as follow:

\begin{center}
\begin{tabular}{c|ccc}
    $x_i$ & $x_i^4$ & & \\
    $x_{i+1}$ & $x_{i+1}^4$ & $x_{i+1}^3+x_{i+1}^2x_{i}+x_{i+1}x_{i}^2+x_{i}^3$ & \\
    $x_{i+2}$ & $x_{i+2}^4$ & $x_{i+2}^3+x_{i+2}^2x_{i+1}+x_{i+2}x_{i+1}^2+x_{i+1}^3$ & $y$
\end{tabular}
\end{center}
Hence we can prove that 
\begin{align*}
    &[x_i,x_{i+1},x_{i+2}]x^4 \\
    = & y \\
    = & \frac{(x_{i+2}^3+x_{i+2}^2x_{i+1}+x_{i+2}x_{i+1}^2+x_{i+1}^3)-(x_{i+1}^3+x_{i+1}^2x_{i}+x_{i+1}x_{i}^2+x_{i}^3)}{x_{i+2}-x_i} \\
    = & \frac{(x_{i+2}^3-x_i^3)+x_{i+1}(x_{i+2}^2-x_i^2+x_{i+1}^2(x_{i+2}-x_i))}{x_{i+2}-x_i} \\
    = & x_1^2+x_2^2+x_3^2+x_1x_2+x_1x_3+x_2x_3 \\
    = & \tau_2(x_i,x_{i+1},x_{i+2}).
\end{align*}

% Topic (b)
\noindent \textbf{(b)}

By the Lemma we have 
\begin{align*}
    &(x_{n+1}-x_1)\tau_k(x_1,\cdots,x_n,x_{n+1}) \\
    = & \tau_{k+1}(x_1,\cdots,x_n,x_{n+1})-\tau_{k+1}(x_1,\cdots,x_n)-x_1\tau_k(x_1,\cdots,x_n,x_{n+1})\\
    = & \tau_{k+1}(x_2,\cdots,x_n,x_{n+1}) + x_1\tau_{k}(x_1,\cdots,x_n,x_{n+1}) \\
      & - \tau_{k+1}(x_1,\cdots,x_n) - x_1\tau_{k}(x_1,\cdots,x_n,x_{n+1}) \\
    = & \tau_{k+1}(x_2,\cdots,x_n,x_{n+1}) - \tau_{k+1}(x_1,\cdots,x_n).
\end{align*}

Now use mathematical induction. $n=0$, it's trival that $\tau_m(x_i)=x_i^m=[x_i]x^m.$

Suppose the Theorem is correct for a nonnegative integer $n<m.$ Then by assumption, 
\begin{align*}
    & \tau_{m-(n+1)}(x_i,\cdots,x_{i+n+1}) \\
    = & \frac{\tau_{m-n}(x_{i+1},\cdots,x_{i+n+1})-\tau_{m-n}(x_i,\cdots,x_{i+n})}{x_{i+n+1}-x_i} \\
    = & \frac{[x_{i+1},\cdots,x_{i+n+1}]x^m-[x_i,\cdots,x_{i+n}]x^m}{x_{i+n+1}-x_i} \\
    = & [x_{i},\cdots,x_{i+n+1}]x^m.
\end{align*}
Thus the Theorem is proved.

\end{document}